<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('修改饲料库存')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-ncFeed-edit" th:object="${ncFeed}">
            <input id="feedId" name="feedId" th:field="*{feedId}"  type="hidden">
			<!--<div class="form-group">
				<label class="col-sm-3 control-label">饲料批次：</label>
				<div class="col-sm-8">
					<input id="feedCode" name="feedCode" th:field="*{feedCode}" class="form-control" type="text">
				</div>
			</div>-->
			<input name="meterialId"  th:field="*{meterialId}" type="hidden"  />
			<div class="form-group">
				<label class="col-sm-3 control-label">饲料名称：</label>
				<div class="col-sm-8">
					<input name="meterialName"  readonly="true" onclick="selectMeterialTree()" id="treeName" type="text"  placeholder="请选择" th:field="*{meterialName}" class="form-control" required>

					<!--<input id="feedName" name="feedName" th:field="*{feedName}" class="form-control" type="text">-->
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">生产厂家：</label>
				<div class="col-sm-8">
					<input id="factory" name="factory" th:field="*{factory}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">入库数量(kg)：</label>
				<div class="col-sm-8">
					<input id="inputAmount" name="inputAmount" required th:field="*{inputAmount}" class="form-control" type="number" step="0.1" min="0" onkeyup=" value=value.replace(/^((\d+\.\d*[1-9]\d{1}))$/,'')">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">库存(kg)：</label>
				<div class="col-sm-8">
					<input id="stockAmout" name="stockAmout" required th:field="*{stockAmout}" class="form-control" type="number" min="0" onkeyup=" value=value.replace(/^((\d+\.\d*[1-9]\d{1}))$/,'')">
				</div>
			</div>
			<!--<div class="form-group">
				<label class="col-sm-3 control-label">单位：</label>
				<div class="col-sm-8">
					<input id="unit" name="unit" th:field="*{unit}" class="form-control" type="text">
				</div>
			</div>-->
			<div class="form-group">
				<label class="col-sm-3 control-label">入库时间：</label>
				<div class="col-sm-8">
					<input id="createTime" data-format="yyyy-MM-dd HH:mm:ss"  name="createTime" placeholder="请选择时间"
						   th:value="*{#dates.format(createTime, 'yyyy-MM-dd HH:mm:ss')}"
						   class="form-control" type="text" th:class="time-input" data-type="datetime" >

					<!--<input id="createTime" name="createTime" th:field="*{createTime}" class="form-control" type="text">-->
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">经手人：</label>
				<div class="col-sm-8">
					<input id="createBy" name="createBy" th:field="*{createBy}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">有效期：</label>
				<div class="col-sm-8">
					<input id="validDate" data-format="yyyy-MM-dd HH:mm:ss"  name="validDate" placeholder="请选择时间"
						   th:value="*{#dates.format(validDate, 'yyyy-MM-dd HH:mm:ss')}"
						   class="form-control" type="text" th:class="time-input" data-type="datetime" >
				<!--<input id="validDate" name="validDate" th:field="*{validDate}" class="form-control" type="text">-->
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">采购人：</label>
				<div class="col-sm-8">
					<input id="purchaser" name="purchaser" th:field="*{purchaser}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
				<textarea id="remark" name="remark" th:field="*{remark}" class="form-control" type="text" rows="4">  </textarea>
				</div>
			</div>
			<!--<div class="form-group">
				<label class="col-sm-3 control-label">饲料类型 1:主饲料 2：辅饲料：</label>
				<div class="col-sm-8">
					<input id="feedType" name="feedType" th:field="*{feedType}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">管理类型 1:鸡舍 2：牛舍：</label>
				<div class="col-sm-8">
					<input id="managerType" name="managerType" th:field="*{managerType}" class="form-control" type="text">
				</div>
			</div>-->
		</form>
    </div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "system/ncChickenFeed2";
		$("#form-ncFeed-edit").validate({
			rules:{
				xxxx:{
					required:true,
				},
			},
			focusCleanup: true
		});

		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/edit", $('#form-ncFeed-edit').serialize());
	        }
	    }

		//物资选择树
		function selectMeterialTree() {
			var treeId = $("#treeId").val();
			var meterialId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val();
			var url = ctx + "system/meterial/selectMeterialTree/" + meterialId;
			var options = {
				title: '物资选择',
				width: "380",
				url: url,
				callBack: doSubmit
			};
			$.modal.openOptions(options);
		}

		function doSubmit(index, layero) {
			var body = layer.getChildFrame('body', index);
			$("#treeId").val(body.find('#treeId').val());
			$("#treeName").val(body.find('#treeName').val());
			layer.close(index);
		}
	</script>
</body>
</html>
